@extends('common.base-master')

@section('html-head')
    <!-- Bootstrap -->
    <script src="{{url('js/lib/bootstrap.min.js')}}"></script>
    <link href="{{url('css/bootstrap.min.css')}}" type="text/css" rel="stylesheet">
    <link href="{{url('css/invest_details.css')}}" type="text/css" rel="stylesheet">
    <script src="{{url('js/invest_details.js')}}"></script>
@endsection

@section('html-body')
<main>
<div class="wrapp">
<section class="headConten">
	<h1>机构详情</h1>
	<div class="user">
		<dl>
			<dt><a href="#"><img src="{{route('Api.Photo.Show',['id'=>$investor->user_id])}}" width="100" height="100"
                            /></a></dt>
			<dd class="info">
				<p><a href="#"><strong>{{$investor->realname}}</strong></a></p>
				<p class="desc">{{$investor->user_desc}}</p>
				<p class="school"><em></em>{{$investor->edu_school}}</p>
			</dd>
			<dd class="test">
				<div class="share_wrap">
					<a href="#" class="share">分享</a>
					<a href="#" class="focus">关注</a>
					<div class="iBtn bdsharebuttonbox">
                        <ul>
                            <li class="qq"><a href="#" style="float: none; background:none;padding-left:0;margin:0;width:100%;height:40px;" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间" ><em>分享到QQ</em></a></li>
                            <li class="weibo"><a href="#" style="float: none; background:none;padding-left:0;margin:0;width:100%;height:40px;" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"><em>分享到新浪</em></a></li>
                            <li class="weixin"><a href="#" style="float: none; background:none;padding-left:0;margin:0;width:100%;height:40px;" class="bds_weixin" data-cmd="weixin" title="分享到微信"><em>分享到微信</em></a></li>
                            <li class="txweibo"><a href="#" style="float: none; background:none;padding-left:0;margin:0;width:100%;height:40px;" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"><em>分享到腾讯</em></a></li>
                        </ul>
						<button>取消</button>
                        <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2",
                                "bdMiniList":false,"bdPic":"http://www.pgzhe.com/images/logo_t.png","bdStyle":"0",
                                "bdSize":"24"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到：","viewSize":"16"}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
                    </div>
				</div>
				<button class="pro_btn" data="{{$investor->id}}">提交项目</button>
			</dd>
		</dl>
	</div>
	<div class="wrap">
		<div class="contain">
			<div class="c_0">
				<p class="result">
                    @if($projects = $user->getInvestProjectByUserId($userId))
                        <em>{{count($projects)}}</em>
                    @else
                        <em>100</em>
                    @endif
                    个</p>
				<p class="c_1">投资数量</p>
			</div>
			<div>
				<p class="result">￥
                @if($user->investor)
                @if($accounts = $user->investor->getInvestAccounts($userId))
                        <em>{{$accounts}}万</em>
                    @else
                        <em>1000万</em>
                @endif
                @endif
                </p>
				<p class="c_1">投资总金额</p>
			</div>
		</div>
		<div class="contain">
			<div>
				<p class="result"><em>900</em>%</p>
				<p class="c_1">投资回报率</p>
			</div>
			<div>
				<p class="result"><em>19</em>个</p>
				<p class="c_1">项目走到下一轮</p>
			</div>
		</div>
	</div>
</section>
<div class="mod">
	<section class="table-list">
		<div class="case case_">
			<h2><em>投资案例</em></h2>
			<p class="tab"><a href="">更多>></a>投资领域：<span>
                @if($fields = $user->getFieldsByUserId($userId))
                        @foreach($fields as $field)
                            <em class="active">{{$field}}</em>
                        @endforeach
                @endif
                </span></p>
			<div class="list">
				<ul>
					<li class="desc">项目简介</li>
					<li>融资阶段</li>
					<li>融资时间</li>
					<li>投资金额</li>
				</ul>
				<div>
					<div class="content">
						<ul>

                        @if($projects = $user->getInvestProjectByUserId($userId))
                            @foreach($projects as $project)
							<li>
								<dl>
									<dt>
										<a href="#"><img src="{{route('Api.ProjectLogo.Show',['id'=>$project->id])}}"></a>
									</dt>
									<dd class="commpany">
										<p><a href="#"><strong>{{$project->project_name}}</strong></a></p>
										<p>{{$project->project_intro}}</p>
									</dd>
									<dd class="list-foo">
										<div class="list_content">
											<p class="stage"><em class="reveal">融资阶段</em>
                                            @if($phase = $user->getPhaseByProjectId($project->id))
                                                <em class="floatR">{{$phase}}</em>
                                            @endif
                                            </p>
									<p class="type"><em class="reveal">融资时间</em>
                                        @if($user->investor)
                                        @if($investTime = $user->investor->getInvestTime($project->id , $userId))
                                            <em class="floatR">{{$investTime}}</em>
                                        @endif
                                        @endif
                                    </p>
											<p class="address"><em class="reveal">投资金额</em>
                                                @if($user->investor)
                                                @if($investAccount = $user->investor->getInvestAccount($project->id , $userId))
                                                    <em class="floatR">￥{{$investAccount}}万</em>
                                                @endif
                                                @endif
                                            </p>
											<!--<p class="member"><button class="reveal">提交项目</button></p>-->
										</div>
									</dd>
								</dl>
							</li>
                            @endforeach
                        @endif

						</ul>
						<p class="more">更多<em>({{count($projects)}})</em></p>
					</div>
				</div>
			</div>
		</div>
		
		<!-- 创业经历 -->
		<div class="case start">
			<h2><em>创业经历</em></h2>
			<div class="list">
					<!-- 输入内容 -->
				<ul>
                    @if($userCreates = $user->userCreate)
                        @foreach($userCreates as $userCreate)
					<li>
						<dl>
							<dt>
								<a href="#"><img src="{{route('Api.ProjectLogo.Show' , ['id'=>$userCreate->project_id])}}" data-bd-imgshare-binded="1"></a>
							</dt>
							<dd class="commpany">
								<p class="name"><a href="#"><strong>{{$userCreate->company}}</strong></a></p>
								<p class="job_title"><em>{{$userCreate->position}}</em>
                                    <time>{{date('Y-m',strtotime($userCreate
								->start_time))}} - {{date('Y-m',strtotime($userCreate->end_time))}}
                                    </time></p>
							</dd>
						</dl>
					</li>
                        @endforeach
                    @endif
				</ul>
			</div>
		</div>
		
		<!-- 工作经历 -->
		<div class="case start worked">
			<h2><em>工作经历</em></h2>
			<div class="list">
					<!-- 输入内容 -->
				<ul>
                    @if($userWorks = $user->userWork)
                        @foreach($userWorks as $userWork)
					<li>
						<dl>
							<dt>
								<a href="#"><img src="{{route('Api.WorkProjectLogo.Show',['id'=>$userWork->logo_id])}}" data-bd-imgshare-binded="1"></a>
							</dt>
							<dd class="commpany">
								<p class="name"><a href="#"><strong>{{$userWork->company}}</strong></a></p>
								<p class="job_title"><em>{{$userWork->position}}</em><time>{{date('Y-m',strtotime($userWork->start_time))}} - {{date('Y-m',strtotime($userWork->end_time))}}</time></p>
							</dd>
						</dl>
					</li>
                        @endforeach
					@endif
				</ul>
			</div>
		</div>

	</section>
	<section class="details">
		<h2><em>详细信息</em></h2>
		<div class="contain">
			<ul>
				<li>个人投资：<em>{{count($projects)}}个</em></li>
				<li>投资机构：
                @if($user->investor)
                @if($investOrg = $user->investor->toInvestOrg)
                    <em>{{$investOrg->invest_name}}</em>
                @endif
                @endif
                </li>
				<li>投资阶段：
                @if($user->investor)
                @if($phases = $user->investor->investor_x_phase)
                @foreach($phases as $phase)
                    <em>{{$phase->phase}}</em>
                @endforeach
                @endif
                @endif
                </li>
				<li>投资领域：
                @if($user->investor)
                @if($fields = $user->investor->investor_x_fields)
                @foreach($fields as $field)
                    <em>{{$field->field}}</em>
                @endforeach
                @endif
                @endif
                </li>
				<li>所在地域：
                @if($user)
                    <em>{{$investor->province}} {{$investor->city}}</em>
                @endif
                </li>
				<li class="concat">联系方式：<a href="#" class="weixin1"></a><a href="#" class="weibo1"></a><a href="#" class="maimai1"></a></li>
			</ul>
		</div>
	</section>
</div>
</div>
<div class="p_pos createProject">
	<!--单选1-->
	<div class="new">
		<p>您还没有项目，现在去创建吧！</p><p>
		<a href="{{route('Home.Project.showCreateProject')}}"><button>创建项目</button></a>
		<em class="close"></em>
		</p>
	</div>
	<!--单选2-->
	<div class="p_pos_s" style="display: none;">
		<p>申请融资</p>
		<select>
            @if(Auth::user())
            @if($userId = Auth::user()->id)
                @if($projects = \App\Project::whereUserId($userId)->get())
                    @foreach($projects as $project)
                        <option value="{{$project->id}}">{{$project->project_name}}</option>
                    @endforeach
                @endif
            @endif
            @endif
		</select><br>
		<button>提交项目</button>
		<em class="close"></em>
	</div>
</div>
<div class="mirror">123</div>
</main>
<script type="text/javascript">
    var getProjectByUserId              = "{{route('Api.Project.getProjectByUserId')}}";
    var CommitProjectToInvestor         = "{{route('Api.Project.CommitProjectToInvestor')}}";
</script>
@endsection